package com.bi.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 主题场景组件实体类
 * 
 * @author BI Platform Team
 * @since 1.0.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tb_theme_scenario_component")
public class ThemeScenarioComponent implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 场景ID
     */
    private Long scenarioId;

    /**
     * 组件标识
     */
    private String componentKey;

    /**
     * 组件类型
     */
    private ComponentType componentType;

    /**
     * 源组件ID
     */
    private Long sourceComponentId;

    /**
     * 组件名称
     */
    private String componentName;

    /**
     * 显示名称
     */
    private String displayName;

    /**
     * 组件版本
     */
    private String version;

    /**
     * 位置配置JSON
     */
    private String positionConfig;

    /**
     * 样式配置JSON
     */
    private String styleConfig;

    /**
     * 数据配置JSON
     */
    private String dataConfig;

    /**
     * 交互配置JSON
     */
    private String interactionConfig;

    /**
     * 动画配置JSON
     */
    private String animationConfig;

    /**
     * 权限配置JSON
     */
    private String permissionConfig;

    /**
     * 自定义配置JSON
     */
    private String customConfig;

    /**
     * Z轴层级
     */
    private Integer zIndex;

    /**
     * 是否可见
     */
    private Boolean visible;

    /**
     * 是否锁定
     */
    private Boolean locked;

    /**
     * 父组件ID
     */
    private Long parentId;

    /**
     * 分组标识
     */
    private String groupKey;

    /**
     * 排序顺序
     */
    private Integer sortOrder;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 组件类型枚举
     */
    public enum ComponentType {
        DATA_COMPONENT("数据组件"),
        CHART_COMPONENT("图表组件"),
        TEXT_COMPONENT("文本组件"),
        IMAGE_COMPONENT("图片组件"),
        VIDEO_COMPONENT("视频组件"),
        MAP_COMPONENT("地图组件"),
        TABLE_COMPONENT("表格组件"),
        FORM_COMPONENT("表单组件"),
        CONTAINER_COMPONENT("容器组件"),
        DECORATION_COMPONENT("装饰组件"),
        CUSTOM_COMPONENT("自定义组件");

        private final String description;

        ComponentType(String description) {
            this.description = description;
        }

        public String getDescription() {
            return description;
        }
    }
}